package com.ysy.tz.core.validator;

public class ValidationMessage {
    private String text;
    private Severity severity;

    public ValidationMessage(Severity severity, String text) {
        this.severity = severity;
        this.text = text;
    }

    public Severity getSeverity() {
        return this.severity;
    }

    public String getText() {
        return this.text;
    }

    public int hashCode() {
        //int prime = true;
        int result = 1;
        result = 31 * result + (this.severity == null ? 0 : this.severity.hashCode());
        result = 31 * result + (this.text == null ? 0 : this.text.hashCode());
        return result;
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        } else if (obj == null) {
            return false;
        } else if (this.getClass() != obj.getClass()) {
            return false;
        } else {
            ValidationMessage other = (ValidationMessage)obj;
            if (this.severity != other.severity) {
                return false;
            } else {
                if (this.text == null) {
                    if (other.text != null) {
                        return false;
                    }
                } else if (!this.text.equals(other.text)) {
                    return false;
                }

                return true;
            }
        }
    }
}
